package gui.organizer;


import java.awt.Dimension;
import java.util.Date;

import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.table.DefaultTableModel;

import util.DateRenderer;
import xml.XMLWorker;

public class EventTableSmall extends JTable {

	public EventTableSmall(Object[][] data, Object[] titles) {
		this.setSize(new Dimension(450, 80));
		this.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
		DefaultTableModel d = new DefaultTableModel(data, titles) {
			@Override
          public Class<?> getColumnClass( int column ) {
              switch( column ){
              case 0: return Integer.class;
              case 1: return Date.class;
              case 2: return String.class;
              case 3: return String.class;
              default: return Object.class;
              }
          }
		};
		this.setModel(d);
		this.setDefaultRenderer(Date.class, new DateRenderer());
		getColumnModel().getColumn(0).setPreferredWidth(33);
		getColumnModel().getColumn(1).setPreferredWidth(74);
		getColumnModel().getColumn(2).setPreferredWidth(71);
		getColumnModel().getColumn(3).setPreferredWidth(280);
	}
}
